package com.example.myBatisDemo.web.dao;

import com.example.myBatisDemo.web.dataobject.LiuzhengxingBillBooks;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
@Mapper
public interface LiuzhengxingBillBooksMapper {
    @Delete({
        "delete from liuzhengxing_bill_books",
        "where bill_id = #{billId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer billId);

    @Insert({
        "insert into liuzhengxing_bill_books (bill_id, bill_type, ",
        "bill_name, bill_amount, ",
        "bill_detail_info, gmt_created, ",
        "gmt_modified, status)",
        "values (#{billId,jdbcType=INTEGER}, #{billType,jdbcType=VARCHAR}, ",
        "#{billName,jdbcType=VARCHAR}, #{billAmount,jdbcType=DOUBLE}, ",
        "#{billDetailInfo,jdbcType=VARCHAR}, now(), ",
        "now(), #{status,jdbcType=INTEGER})"
    })
    int insert(LiuzhengxingBillBooks record);

    @Select({
        "select",
        "bill_id, bill_type, bill_name, bill_amount, bill_detail_info, gmt_created, gmt_modified, ",
        "status",
        "from liuzhengxing_bill_books",
        "where bill_id = #{billId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="bill_id", property="billId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="bill_type", property="billType", jdbcType=JdbcType.VARCHAR),
        @Result(column="bill_name", property="billName", jdbcType=JdbcType.VARCHAR),
        @Result(column="bill_amount", property="billAmount", jdbcType=JdbcType.DOUBLE),
        @Result(column="bill_detail_info", property="billDetailInfo", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_created", property="gmtCreated", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    LiuzhengxingBillBooks selectByPrimaryKey(Integer billId);

    @Select({
        "select",
        "bill_id, bill_type, bill_name, bill_amount, bill_detail_info, gmt_created, gmt_modified, ",
        "status",
        "from liuzhengxing_bill_books"
    })
    @Results({
        @Result(column="bill_id", property="billId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="bill_type", property="billType", jdbcType=JdbcType.VARCHAR),
        @Result(column="bill_name", property="billName", jdbcType=JdbcType.VARCHAR),
        @Result(column="bill_amount", property="billAmount", jdbcType=JdbcType.DOUBLE),
        @Result(column="bill_detail_info", property="billDetailInfo", jdbcType=JdbcType.VARCHAR),
        @Result(column="gmt_created", property="gmtCreated", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    List<LiuzhengxingBillBooks> selectAll();

    @Update({
        "update liuzhengxing_bill_books",
        "set bill_type = #{billType,jdbcType=VARCHAR},",
          "bill_name = #{billName,jdbcType=VARCHAR},",
          "bill_amount = #{billAmount,jdbcType=DOUBLE},",
          "bill_detail_info = #{billDetailInfo,jdbcType=VARCHAR},",
            "",
          "gmt_modified = now(),",
          "status = #{status,jdbcType=INTEGER}",
        "where bill_id = #{billId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(LiuzhengxingBillBooks record);
}